﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        { 

        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        YqhData obj = new YqhData();
        string sql = string.Format(@"insert into userinfo
                                       (uname,
                                        upwd,
                                        usex,
                                        uemail,
                                        uqq,
                                        ubirthday,
                                        uheadurl)
                                        values(
                                              '{0}',
                                              '{1}',
                                               {2},
                                              '{3}',
                                               {4},
                                              '{5}',
                                              '{6}')",
                                                     txtname.Text,
                                                     txtpwd2.Text,
                                                     rdbsex.SelectedValue,
                                                     txtemail.Text,
                                                     txtQQ.Text,
                                                     txtsr.Value,
                                                     ddlhead.SelectedValue);
        int i = 0;
        try
        {
            i = obj.ExecuteSql(sql);
        }
        catch
        {
            i = 0;
        }

        if (i >= 1)
        {
            Response.Write("<script>alert('注册成功！现在你可以登陆了！');window.location.href = 'Index.aspx';</script>");
        }
        else
        {
            obj.ShowMsg("注册失败！请重新注册！");
        }
    }

}
